# -*- coding: utf-8 -*-
"""
Created on Sun Jan 13 21:37:10 2019

@author: 89580
"""

#import random
#点击1
#播放2
#点赞3
#收藏4
#付费观看5
#站外分享6
#评论7
#
#albet_Num = ["a","b","c","d","e","f","g","h","i","1","2","3","4","5","6","7","A","B","C","O","P","Q"]
#user_List = ["one","two","three","four","five"]
#num = ["1","2","3","4","5","6","7","8","9","0"]
#log_type_array=["1","2","3","4","5","6","7"]
#
#file_object = open('./2000logfile.txt','w')
#
#for n in range(0,2000):
#    cookie = "".join(random.sample(albet_Num,6))
#    uid = "".join(random.sample(user_List,1))
#    user_agent = "Macintosh Chrome Safari"
#    ip = "192.168.89.177"
#    video_id = "".join(random.sample(num,7))
#    topic = "小米发布会"
#    order_id = "0"
#    log_type = "".join(random.sample(log_type_array,1))
#    final = cookie + "&" + uid + "&" + user_agent + "&" + ip + "&" + video_id + "&" + topic + "&" + order_id + "&" + log_type + "\r\n"
#    print (final)
#    file_object.write(final)
#file_object.close()
#    
click_action = {} #map结构 
file =open('./2000logfile.txt')
for line in file.readlines():
    line =line.strip()
    ls=line.split("&")
    if (len(ls)==1 or ls[7] !="1"):
        continue
    if ls[1] not in click_action.keys():
        click_action[ls[1]] = []
    click_action[ls[1]].append(ls[4])
    
for k,v in click_action.items():
    print (k+"\t"+str(len(v))+"\t"+"&&".join(v))

